<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .container{
            width: 400px;
            border:1px solid black;
            height: 200px;
            margin:100px auto;
        }
        .btns{
            margin-bottom: 50px;
            text-align: center;
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: rgb(173, 89, 89);
            margin:0 auto;
            transition: 1.5s;
        }
        .widther{
            width: 200px;
        }
        .higher{
            height: 200px;
        }
        .blue{
            background-color: rgb(142, 127, 226);
        }
        .hide{
            opacity: 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="btns">
            <button id="widther">变宽</button>
            <button id="higher">变高</button>
            <button id="color">变色</button>
            <button id="hide">隐藏</button>
            <button id="reset">重置</button>
        </div>
        <div class="box">

        </div>
    </div>
    <script>
        var widther = document.getElementById('widther')
        var higher = document.getElementById('higher')
        var color = document.getElementById('color')
        var hide = document.getElementById('hide')
        var reset = document.getElementById('reset')
        var box = document.querySelector('.box')
        var classArr = ['widther','higher','blue','hide']
        widther.onclick = function(){
            box.classList.add('widther')
        }
        higher.onclick = function(){
            box.classList.add('higher')
        }
        color.onclick = function(){
            box.classList.add('blue')
        }
        hide.onclick = function(){
            box.classList.add('hide')
        }
        reset.onclick = function(){
            // box.classList.remove('widther')
            // box.classList.remove('higher')
            // box.classList.remove('blue')
            // box.classList.remove('hide')
            //box.className = 'box'
            for( c of classArr){
                box.classList.remove(c)
            }
        }


    </script>
</body>
</html>